define(function(require, exports){
	exports.onMain = function(boot,data,app){
		if (!app.routerValid('admin.sweety')) {
			return;
		}
		var title = LANG('创意包列表');
		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			type: 'sidebar',
			title:title
		});

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name, 'sweety/action/list.base', {

		}, function(mod, created){
			if(created){
				mod.reload();
			}
		});
	};
	exports.onEdit = function(boot,data,app){
		var param = data && data.param;

		var auth = param ? 'sweety.update' : 'sweety.add';
		if (!app.routerValid(auth)) {
			return;
		}

		var title = param ? LANG('编辑创意包') : LANG('添加创意包');

		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title:	title,
			type: 'scroll'
		});

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name, 'sweety/action/edit.base', {
		}, function(mod){
			mod.reset();
			if(param){
				mod.load(+param);
			}
		});

	};

	exports.onVerify = function(boot,data,app){
		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title:LANG('创意包审核详情'),
			type: 'tabSidebar'
		});

		if (!app.routerValid('&sweety.list,sweetyCreative.list')) {
			return;
		}

		if(app.checkRight('sweetyCreative.list')){
			con.createBusiness(data.name + 'creativeVerify', 'sweety/action/verify.creative', {
				tabText: LANG('创意')
			}, function(mod){
			});
		}
		if(app.checkRight('sweety.list')){
			con.createBusiness(data.name + 'sweetyVerify', 'sweety/action/verify.sweety', {
				tabText: LANG('创意包')
			}, function(mod, created){
				if(created){
					mod.reload();
				}
			});
		}

	};
});